#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const ll maxn = 2e6 + 100;
ll a[10];
ll Q[maxn];
ll NY[maxn];

ll qmul(ll a, ll b)
{
    ll sum = 1;
    while (b)
    {
        if (b & 1)
        {
            sum = (sum * a) % mod;
        }
        a = (a * a) % mod;
        b >>= 1;
    }
    return sum;
}

ll C(ll n, ll m)
{
    return (Q[n] * NY[m] % mod) * NY[n - m] % mod;
}
int main()
{
    Q[0] = 1;
    for (ll i = 1; i < maxn; ++i)
        Q[i] = Q[i - 1] * i % mod;
    NY[maxn - 1] = qmul(Q[maxn - 1], mod - 2);
    for (ll i = maxn - 2; i >= 0; --i)
        NY[i] = (1ll * NY[i + 1] * (i + 1)) % mod;
    ll pre = 0;
    for (ll i = 1; i <= 9; i++)
    {
        cin >> a[i];
        pre += a[i];
    }

    ll Bl = 1, t = 0;
    for (ll i = 0; i < pre; i++, Bl = Bl * 10 % mod)
    {
        t = (t + Bl) % mod;
    }
    Bl = t;
    ll ans = 0, now, t;
    for (ll i = 1; i <= 9; i++)
    {
        if (a[i] == 0)
            continue;
        t = pre;
        now = 1;
        now = now * C(pre - 1, a[i] - 1) % mod;
        t -= a[i];
        for (ll j = 9; j >= 1; j--)
        {
            if (j == i || a[j] == 0)
                continue;
            now = now * C(t, a[j]) % mod;
            t -= a[j];
        }
        ans = (ans + i * now % mod * Bl % mod) % mod;
    }
    cout << ans << endl;
}